﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Northwind.NET.FE.Forms
{
    public partial class CustomersLabelsDialog : Form
    {
        public CustomersLabelsDialog()
        {
            InitializeComponent();
        }

        private bool allCountries;
        private string selectedCountryName
        {
            get
            {
                if (countriesComboBox.SelectedValue == null)
                    return "(NONE)";
                else return countriesComboBox.SelectedValue.ToString(); 
            }
        }
        private void CustomersLabelsDialog_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dataModelDataSet.CustomerCountries' table. You can move, or remove it, as needed.
            this.customerCountriesTableAdapter.Fill(this.dataModelDataSet.CustomerCountries);
            allCountries = true;
        }

        private void previewButton_Click(object sender, EventArgs e)
        {
            string message = string.Format("TODO!: All Countries = {0}, Specific Country = '{1}'", allCountries, selectedCountryName);   
            MessageBox.Show(message, Globals.APPLICATION_TITLE);  
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            _cancelButtonClicked = true;
            MessageBox.Show("TODO! => Return focus to the caller form", Globals.APPLICATION_TITLE);
            this.Close(); 
        }

        private void specificCounrtyRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (specificCounrtyRadioButton.Checked)
            {
                countriesComboBox.Enabled = true;
                allCountries = false;
            }
            else
            {
                countriesComboBox.Enabled = false;
                allCountries = true;
            }
        }

        private bool _cancelButtonClicked;
        private void CustomersLabelsDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            //TODO: return focus to the caller form here
        }

    }
}
